<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
         /*function duoxuan() {
             var a=document.getElementsByTagName("input");
            var  s="";
                for(var i=0;i<a.length;i++){
                       s+=a[i].value+"&nbsp;&nbsp"
                }
             document.getElementById("replace").innerHTML=s;
         }*/
         function  selectAll() {
             var  c=0;
               var d=document.getElementsByTagName("input")
             for(let a1 in d){
                 if (d[a1].checked==true) {
                     c++;
                 }
             }
             alert(c)
         }
    </script>
</head>
<body>

<input type="checkbox" name="product" value="boeing747"/>波音747客机
<br/>
<input type="checkbox" name="product" value="dayaozi"/>英国皇家特供大腰子
<br/>
<input type="checkbox" name="product" value="mazalati"/>马萨拉蒂
<br/>
<input type="checkbox" name="product" value="汤臣一品顶层豪宅"/>汤臣一品顶层豪宅客机
<br/>
<input type="button" value="replace" onclick="selectAll()">
</body>
</html>